package com.ruoyi.blogs.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.blogs.mapper.BsAnswerMapper;
import com.ruoyi.blogs.domain.BsAnswer;
import com.ruoyi.blogs.domain.vo.BsAnswerVo;
import com.ruoyi.blogs.service.IBsAnswerService;
import com.ruoyi.blogs.service.IBsFaqService;

/**
 * 回答Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-11-24
 */
@Service
public class BsAnswerServiceImpl implements IBsAnswerService 
{
    @Autowired
    private BsAnswerMapper bsAnswerMapper;

    /**
     * 查询回答
     * 
     * @param id 回答主键
     * @return 回答
     */
    @Override
    public BsAnswer selectBsAnswerById(Long id)
    {
        return bsAnswerMapper.selectBsAnswerById(id);
    }

    /**
     * 查询回答列表
     * 
     * @param bsAnswer 回答
     * @return 回答
     */
    @Override
    public List<BsAnswer> selectBsAnswerList(BsAnswer bsAnswer)
    {
        return bsAnswerMapper.selectBsAnswerList(bsAnswer);
    }

    /**
     * 新增回答
     * 
     * @param bsAnswer 回答
     * @return 结果
     */
    @Override
    public int insertBsAnswer(BsAnswer bsAnswer)
    {
        bsAnswer.setCreateTime(DateUtils.getNowDate());
        bsAnswer.setUserId(SecurityUtils.getUserId());
        return bsAnswerMapper.insertBsAnswer(bsAnswer);
    }

    /**
     * 修改回答
     * 
     * @param bsAnswer 回答
     * @return 结果
     */
    @Override
    public int updateBsAnswer(BsAnswer bsAnswer)
    {
        return bsAnswerMapper.updateBsAnswer(bsAnswer);
    }

    /**
     * 批量删除回答
     * 
     * @param ids 需要删除的回答主键
     * @return 结果
     */
    @Override
    public int deleteBsAnswerByIds(Long[] ids)
    {
        return bsAnswerMapper.deleteBsAnswerByIds(ids);
    }

    /**
     * 删除回答信息
     * 
     * @param id 回答主键
     * @return 结果
     */
    @Override
    public int deleteBsAnswerById(Long id)
    {
        return bsAnswerMapper.deleteBsAnswerById(id);
    }

    @Override
    public List<BsAnswerVo> selectBsAnswerVoList(BsAnswerVo bsAnswerVo) {
        return bsAnswerMapper.selectBsAnswerVoList(bsAnswerVo);
    }
}
